-- 未晚之为
local weiwanzhiwei = fk.CreateSkill {
    name = "mcdh_weiwanzhiwei",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

weiwanzhiwei:addEffect(fk.Damaged,{
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(self) and not player:isNude()
    end,
    on_cost  = function(self, event, target, player, data)
        return player.room:askForSkillInvoke(player, self.name, nil, "#weiwanzhiwei-invoke::" )
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local ids=room:askForCard(player, 1, 2, true, self.name, false, ".", "#weiwanzhiwei-draw::" )
        room:moveCards({
            ids = ids,
            from = player.id,
            toArea = Card.DrawPile,
            moveReason = fk.ReasonJustMove,
            skillName = self.name,
            drawPilePosition =-1,
        })
        room:drawCards(player,#ids,self.name)
    end,
})

Fk:loadTranslationTable{
    ["mcdh_weiwanzhiwei"] = "未晚之为",
    [":mcdh_weiwanzhiwei"] = "当你受到伤害后，你可以将至多两张牌置于牌堆底，然后摸等量的牌。",
    ["#weiwanzhiwei-invoke"] = "未晚之为:是否将至多2张牌置于牌堆底，然后摸等量牌",
    ["#weiwanzhiwei-draw"] = "未晚之为:将至多2张牌置于牌堆底，然后摸等量牌"

}

return weiwanzhiwei